@include('admin.header')
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="/mobile/index">手机型号</a></li>
			<li><a href="/mobile/add" target="_self">添加型号</a></li>
		</ul>
		<form class="js-ajax-form" action="" method="post">
			<div class="well form-search" method="post" action="{{asset('mobile/index')}}">
				分类：
				<select name="cate_id" style="width: 120px;">
					<option value='0'>全部</option>
					@foreach($category as $key=>$vo)
						<option value="{{$vo->id}}">{{$vo->name}}</option>
					@endforeach
				</select>
				关键字：
				<input type="text" name="keywords" style="width: 200px;" value="{{$keywords or ''}}" placeholder="请输入关键字...">
				<input type="submit" class="btn btn-primary" value="搜索" />
			</div>
			<div class="js-ajax-form" action="" method="post">
				<div class="table-actions">
				</div>
				<table class="table table-hover table-bordered table-list">
					<thead>
						<tr>
							<th>ID</th>
							<th>手机型号</th>
							<th>预览图</th>
							<th>成本价</th>
							<th>市场价</th>
							<th>销售价</th>
							<th>分期数量</th>
							<th>库存</th>
							<th>已售出</th>
							<th>基础任务</th>
							<th>状态</th>
							<th>时间</th>
							<th>操作</th>
						</tr>
					</thead>
					@foreach($data as $key => $vo)
						<tr>
							<td><b>{{$vo->id}}</b></td>
							<td>{{$vo->title}}</td>
							<td><img width='80' src="{{$vo->pic}}"></td>
							<td>{{$vo->cost_price}}</td>
							<td>{{$vo->market_price}}</td>
							<td>{{$vo->sell_price}}</td>
							<td>{{$vo->return_num}}</td>
							<td>{{$vo->store_num}}</td>
							<td>{{$vo->sell_num}}</td>
							<td>{{$vo->base_task}}</td>
							<td>
								@if($vo->status == 0)
									删除
								@elseif($vo->status == 1)
									正常
								@else
									已停止领取
								@endif
							</td>
							<td>{{$vo->create_time}}</td>
							<td>
								<a href="{{asset('mobile/edit')}}?id={{$vo->id}}">编辑</a> |
								<a href="javascript:void(0)" rel="{{$vo->id}}" class="js-mobile-delete">删除</a>
							</td>
						</tr>
					@endforeach
					<tfoot>
					<tr>
						<th>ID</th>
						<th>手机型号</th>
						<th>预览图</th>
						<th>成本价</th>
						<th>市场价</th>
						<th>销售价</th>
						<th>分期数量</th>
						<th>库存</th>
						<th>已售出</th>
						<th>基础任务</th>
						<th>状态</th>
						<th>时间</th>
						<th>操作</th>
					</tr>
					</tfoot>
				</table>
				<div class="table-actions">
				</div>
				<div class="pagination">{{$data->render()}}</div>
			</div>
		</form>
	</div>
	<script src="/static/js/common.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.js-mobile-delete').click(function(){
				var id = $(this).attr('rel');
				layer.confirm('你确定要删除吗？', {
					btn: ['确定','取消']
				}, function(){
					$.post('{{asset("mobile/del")}}',{id:id},function (msg) {
						if(msg.status == 1){
							layer.alert(msg.info, {
								title: '提示',
								icon: 1,
							});
							window.location.href = '{{asset("mobile/index")}}';
						}else{
							layer.alert(msg.info, {
								title: '提示',
								icon: 2,
							});
						}
					},'json');
				},function() {

				});
			});
		});
	</script>
</body>
</html>